<%@ page contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib  uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib  uri="http://www.springframework.org/security/tags" prefix="sec" %>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib  uri="http://www.joda.org/joda/time/tags" prefix="joda" %>
<c:forEach items="${plans}" var="plan">
<table class="table table-bordered table-hover table-condensed">
	<caption>原始生产计划</caption>
	<thead>		
		<tr>
    <th width="150">产品代码</th>
    <th width="150">产品名称</th>
    <th width="80">单位</th>
    <th width="100">计划量</th>
    <th width="80">工艺</th>
    <th width="150">计划调整</th>
    <th width="150">备注</th>
  </tr>	
	</thead>
	<tbody>
		<c:forEach items="${plan.proterozoic}" var="item" varStatus="vs">
			<tr class="${empty item.technics?"":"success"}">
				<td>					
					
					${item.owner.code}
					</td>

				<td>${item.owner.name}</td>

				<td>${item.owner.priceUnit}</td>
                
				<td>
				<span class="badge badge-important">${item.finalValue}</span>
				
				</td>
				<td>
                
                <c:if test="${item.technics!=null}">                	
                	<span class="label label-inverse">${item.technics.name}</span>
                </c:if>
                                 
                </td>
				<td>
				 <div class="input-prepend">
				    
                     <div class="btn-group">						
						<button type="button" data-toggle="dropdown"
							class="btn  btn-success  btn-mini dropdown-toggle">
							计划调整<span class="caret"></span>
						</button>
						<ul class="dropdown-menu">
							<c:set var="mdfc" value="0" />
							<c:forEach items="${item.modifies}" var="mdf" varStatus="vs">
								<c:set var="mdfc" value="${mdfc+mdf.value}" />
								<li><a href="javascript:;">
								         <span class="label label-warning"> ${mdf.value}</span>
								        -
								        <joda:format value="${mdf.updateDate}" pattern="yyyy-MM-dd hh:mm:ss" />
									    -
									    <span class="label label-important">${mdf.user.localName}</span> 
								        </a> 	    
						        </li>
							</c:forEach>
							<li><a href="javascript:;">累计修改量:${mdfc}</a></li>
						</ul>
					</div>					
                 </div>
					</td>
				<td>${item.remark} </td>			
			</tr>				
		</c:forEach>
	</tbody>
</table>

<table class="table table-striped table-bordered table-condensed table-hover">
  <caption></caption>
  <thead>
    <tr>
    <th width="150">产品代码</th>
    <th width="150">产品名称</th>
    <th width="80">单位</th>
    <th width="100">计划量</th>
    <th width="80">工艺</th>
    <th width="150">计划调整</th>
    <th width="150">备注</th>
  </tr>
  </thead>
  <tbody>
    <c:forEach items="${plan.generated}" var="itemMap" varStatus="mvs">
	  <tr class="info">
	      <td>所属产品</td>
	      <td colspan="6">${itemMap.key}</td>
	   </tr>
	  <c:forEach items="${itemMap.value}" var="item" varStatus="vs">
	   
	   <tr class="${empty item.technics?"":"success"}">
       <td>      
          ${item.owner.code}    
       
       </td>
       
       <td>
       ${item.owner.name}
       </td>
       
       <td>
        ${empty item.owner.priceUnit?"万发":item.owner.priceUnit}
       </td>
       <td>
           <span class="badge badge-important">${item.finalValue}</span> 
       </td>        
       <td>
            
            <c:if test="${item.technics!=null}">
                <span class="label label-inverse">${item.technics.name}</span>
            </c:if>        
                
       </td>       
      
              
       <td>
           <div class="input-prepend">
				   
				 
                     <div class="btn-group">						
						<button type="button " data-toggle="dropdown"
							class="btn  btn-success dropdown-toggle btn-mini">
							计划调整<span class="caret"></span>
						</button>
						<ul class="dropdown-menu">
							<c:set var="mdfc" value="0" />
							<c:forEach items="${item.modifies}" var="mdf" varStatus="vs">
								<c:set var="mdfc" value="${mdfc+mdf.value}" />
								<li><a href="javascript:;">
								       <span class="label label-warning"> ${mdf.value}</span>
								        -
								        <joda:format value="${mdf.updateDate}" pattern="yyyy-MM-dd hh:mm:ss" />
								        -
									   <span class="label label-important">${mdf.user.localName}</span> 
								        </a> 	    
						        </li>
							</c:forEach>
							<li><a href="javascript:;">累计修改量:${mdfc}</a></li>
						</ul>
					</div>	
					 			
                 </div>
       </td>
       
       <td>
       ${item.remark}
       </td>           
       </tr>
                
        </c:forEach>
	</c:forEach>
  </tbody>
</table>

</c:forEach>